{include file="public/head" /}
<style>
    .layui-form-item .layui-input-company {
        width: auto;
        padding-right: 10px;
        line-height: 38px;
    }
</style>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <div class="layui-form layuimini-form">
                <div class="layui-form-item">
                    <label class="layui-form-label required">登录账号</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" lay-verify="required" lay-reqtext="管理账号不能为空"
                            placeholder="请输入管理账号" value="{$admin.username}" class="layui-input">
                        <tip>填写自己管理登录账号</tip>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.use(['form', 'miniTab'], function () {
            var form = layui.form,
                layer = layui.layer,
                miniTab = layui.miniTab,
                $ = layui.$;

            //监听提交
            form.on('submit(saveBtn)', function (data) {

                $.post("{:url('index/user_setting')}", data.field, function (res) {
                    if (res.code > 0) {
                        layer.msg(res.msg, function () {
                            window.location = "{:url('login/index')}";
                            // miniTab.deleteCurrentByIframe();
                        });
                    } else {
                        layer.msg(res.msg, { time: 1800, icon: 2 });
                    }
                });
                return false;
            });

        });
    </script>
    {include file="public/footer" /}